Implementing transactional mechanisms on data segments using distributed shared memory

ABSTRACT

Systems, Methods, and Computer Program Products are provided for implementing transactional mechanisms by a plurality of procedures on data segments by using distributed shared memory (DSM) agents in a clustered file system (CFS). A new data segment is allocated and an associated cache data segment and metadata data segments, which are allocated for the new data segment and loaded into a cache and modified during the allocating of the new data segment, are added to a list of data segments modified within an associated transaction. The DSM agents assign an exclusive permission to the new data segment.

REFERENCE TO RELATED APPLICATION

The present application is a Continuation of U.S. patent applicationSer. No. 12/197,953 filed on Aug. 25, 2008, the contents of which areincorporated herein by reference.

FIELD OF THE INVENTION

The present invention relates to apparatus and methods for implementingtransactional processing in a clustered file system, implemented over acluster of connected computers.

BACKGROUND

Distributed shared memory (DSM) provides an abstraction that allowsusers to view a physically distributed memory of a distributed system asa virtual shared address space. DSM provides a convenience forprogrammers of distributed applications, reducing or eliminating therequirement to be aware of the distributed architecture of the systemand the requirement to use a less intuitive form of communication on adistributed system via message passing. DSM also provides a means todirectly port software written for non-distributed systems to work ondistributed systems.

There are many forms of DSM algorithms and technologies, all of themsharing a fundamental architecture of being composed of distributedagents deployed on a plurality of clustered nodes, maintaining localdata structures and memory segments, and using a communication protocolover a message passing layer to coordinate operations. Message trafficshould be minimized for a given load of work, and memory coherencyshould be maintained.

Users of a file system may need a transactional interface and method ofoperation for operating on files. Fundamentally, users may require thatmultiple updates applied on multiple segments within multiple files areassociated with a single transaction, such that either all the updateswithin a transaction are applied to the files or alternatively none ofthe changes are applied. Further requirements may be the following:Enable to roll-back an ongoing transaction, by restoring the state ofthe files on which the transaction operated to the state preceding thebeginning of the transaction. Upon confirmation of the file system oncommitting a transaction, the operations of the transaction areguaranteed to be durable and apply on the relevant files regardless ofany fault that may occur after that confirmation. In case a fault occursbefore a transaction is confirmed by the file system, it is guaranteedthat no operations related to this transaction are applied on therelevant files, and the state is restored to the point after the lastconfirmed transaction. Furthermore, transactions are initiatedconcurrently by multiple users, and should be processed by the filesystem as concurrently as possible. Specifically, transactions thatupdate disjoint portions of the file system should be processedconcurrently, while transactions that share updated portions should beserialized. Moreover, users performing read only operations should beallowed to access the file system concurrently, while users performingtransactions should be mutual exclusive and serialized with all otherusers that access the same file system portions affected by thesetransactions. Basically, all transactions should be isolated, in thesense that no operation external to a transaction can view the data inan intermediate state.

Existing file systems generally do not support these requirements. Knownsystems include journaling file systems where journal based transactionprocessing is applied to file system operations. Such file systemsmaintain a journal of the updates they intend to apply on their diskstructures, and periodically apply these updates, via the checkpointprocess, on the actual disk structures. After a systems fault, recoveryinvolves scanning the journal and replaying updates selectively untilthe file system is consistent. However, in journaling file systems, theoperations on which transactional consistency is applied are file systemoperations defined according to the file system logics, rather than useroriented operations applied to the file system. In other words,transactional processing in such file systems protects the atomicity,consistency, isolation and durability of file system operations, ratherthan user operations which are more complex.

Journaling file systems typically define a single write or updateoperation issued by a user as a transaction. Such an operation generallyinvolves several internal update operations on file system metadatastructures and user data structures. Occurrence of faults (like a powerfailure or a system unrecoverable fault) during processing of theseinternal operations can leave the file system in an invalid intermediatestate. Grouping these internal operations into a transaction enables thefile system to maintain its consistency, considering possible failuresduring processing, relative to individual user operations on the filesystem. However, the requirement of considering several user operations,defined and grouped by the user logic, as a single atomic transaction,and the subsequent requirements facilitating transaction processing ofuser oriented operations, remain unanswered in existing file systems.Some journaling file systems group several operations within atransaction, but this is done according to the file system logic andmechanisms, and without consideration of user logic. Journaling filesystems also differ in the type of information written to the journal,which may be blocks of metadata and user data after the updates, oralternatively some other compact description of the updates.

Note that in non journaled file systems, detecting and recovering frominconsistencies due to faults during processing requires a complete scanof the file system data structures, which may take a long time. In bothjournaled and non journaled file systems users are blocked until therecovery process completes.

In clustered (a.k.a. shared disk) file systems, which provide concurrentread and write access for multiple clustered computers to files storedin shared external storage devices, transaction processing andconsistency should be implemented over the cluster and is morechallenging. For example, a clustered file system should typicallysupport an on-line recovery process, where an operational computer inthe cluster recovers the consistency of the file system, during normalwork in the cluster, after failure of other computers in the cluster.

SUMMARY OF THE INVENTION

In accordance with the one embodiment of the invention, a method isprovided which includes:

-   -   providing a clustered file system (CFS) residing on a cluster of        nodes for accessing a shared storage of file system data;    -   providing a local cache memory on each node to reduce file        system access to the shared storage and for processing        modifications to the file system data;    -   providing a distributed shared memory (DSM) agent on each node        wherein:    -   the DSM agents collectively manage access permissions to the        entire space of file system data as data segments;    -   the DSM agents utilize the distributed cache memories of the CFS        as a virtual shared cache to provide transaction based        modifications on data segments, for user defined operations and        CFS defined operations.

In one embodiment, the DSM agents determine the latest contents of filesystem data to maintain coherency between the distributed cache memoriesof the CFS. In response to a user request to a local node, useroperations are applied to data segments in the associated local cachememory, including reading requested data segments to the local cachememory and modifying data segments within the local cache memory, inaccordance with permissions granted by the DSM agents. Users performingread only operations are allowed to access the file system dataconcurrently, while the operations of users that require access formodification of a same data segment are serialized.

In another embodiment, each node is provided with a journal for storingcommitted transactions generated by users on that node. In a commitoperation, the modified data segments are written from the local cachememory to the transaction journal of the local node. In a checkpointoperation, the modified and committed data segments are written from thelocal cache memory to a final location in the shared storage. In aroll-back operation, for cancellation of a current transaction, datasegments are written from the transaction journal to the associatedlocal cache memory to restore the local cache memory to its state priorto the transaction. In a recovery operation, wherein upon failure of oneor more nodes, data segments are written from the transaction journalsof the failed nodes to their final locations in the shared storage, forrecovering file system data.

In one embodiment, the DSM agents provide a global ordering of therecentness of transactions and data segment contents across the cluster.The global ordering may be based on a termination time for eachtransaction. The global ordering may be based on assignment of atransaction identifier which is unique, with respect to all othertransaction identifiers existing in the CFS, at the time of a commitoperation of a transaction.

In one embodiment, each node has a CFS agent for maintaining a local setof data segments in the local cache memory and associated localparameters which include an access permission and ownership by the localDSM agent.

In another embodiment, during a checkpoint operation, users that requireaccess for modification of a data segment being written within thecheckpoint operation, are provided with a shadow data segment, whosecontents is identical to that of the original data segment used by thecheckpoint operation. When the checkpoint operation completes, theshadow data segment replaces in local cache memory the original datasegment used by the checkpoint operation.

In another embodiment, the method includes providing a list of datasegments modified within an ongoing transaction. A roll-back procedurescans the list to identify the location of the latest contests of a datasegment prior to the transaction.

More specifically, each node may have a local transaction journal forstoring committed transactions generated by users on that node. Then,for each modified data segment the roll-back procedure identifies thelocation of the latest contents prior to the transaction by:

-   -   if the data segment was marked as modified in the cache at the        time it was inserted into the list, then the latest contents of        this data segment appears only in the journal;    -   otherwise, if the data segment was not marked as modified in the        cache at the time it was inserted into the list, then the latest        contents of this data segment appears in its final location in        the shared storage;    -   the type of each data segment being recorded in the list during        insertion of the data segment into the list;    -   and wherein:    -   all data segments in the list whose latest contents appear in        their final location are discarded from the cache;    -   for all the other data segments in the list, their latest        contents is restored from the journal into the cache, by        scanning the journal from its ending to its beginning and        considering only the first occurrences of these data segments in        the journal, and then setting their modification indication to        true;    -   and finally, the procedure releasing the exclusive permissions        on all the data segments involved in the cancelled transaction.

In one embodiment, the recovery procedure scans concurrently thetransaction journals of the one or more failed nodes, beginning with thelatest complete transaction in each journal, and following a descendingorder of the recentness of the transactions. Only the most recentoccurrence of each data segment is considered and, for each such datasegment the procedure determines if it should be copied to its finallocation in shared storage by validating that ownership of the datasegment is not associated with any of the remaining operational nodes.

In another embodiment, in a procedure for allocating a new data segment,wherein an associated cache data segment and metadata data segment areloaded into the cache memory and modified in the process of allocatingthe data segment, the cache data segment and metadata data segments areadded to a list of data segments modified within the associatedtransaction, and the DSM agents then assign an exclusive permission onthe newly allocated data segment. In a procedure for de-allocating analready allocated data segment, the procedure insures that there is anactive exclusive permission on the de-allocated disk data segment. Theprocedure removes the de-allocated data segment from the list of datasegments modified within the associated transaction and inserts into thelist metadata data segments that were modified in the process ofde-allocating the data segment.

In another embodiment, in a procedure for marking a retrieved datasegment as modified, the procedure inserts the data segment into a listof data segments modified in the associated transaction, accompaniedwith an indication of whether this data segment was marked as modifiedbefore this operation.

In other embodiments of the invention, systems and computer programproducts are provided which implement the previously described methodembodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

Several embodiments of the present invention are described hereinafterwith reference to the drawings, in which:

FIG. 1 shows schematically a system for implementing a distributedshared memory in accordance with one embodiment of the invention inwhich DSM Agents A and B reside on different clustered nodes A and B andcommunicate via an unreliable message passing layer;

FIG. 2 is an embodiment of a data structure for DSM table entries;

FIG. 3 is one embodiment of type and data structures for DSM messages;

FIG. 4 is a flow diagram of a procedure for granting shared permissionto a local user, according to one embodiment of the invention;

FIG. 5 is a flow diagram of a procedure for granting exclusivepermission to a local user, in accordance with one embodiment of theinvention;

FIG. 6 is a flow diagram of a procedure for notification of completionon usage of a local user, in accordance with one embodiment of theinvention;

FIG. 7 is a flow diagram of a procedure for processing a permissionrequest from a remote user, in accordance with one embodiment of theinvention;

FIG. 8 is a schematic illustration of four case scenarios relating to aprotocol for recovering ownership of a data segment among the DSMagents, in accordance with various embodiments of the invention;

FIG. 9 is a flow diagram of a procedure for detecting and resolving a noowner messaging deadlock, according to one embodiment;

FIG. 10 is a flow diagram of a procedure for pruning obsolete messages,according to one embodiment;

FIG. 11 is a flow diagram of a procedure for recovering the latestcontents of a data segment, according to one embodiment;

FIG. 12 is a flow diagram of a procedure for modifying the entry of adata segment after sending a response message, according to oneembodiment;

FIG. 13 shows schematically a system for implementing a distributedshared memory in a clustered file system (CFS) in accordance with oneembodiment of the invention in which CFS agents A and B, each includinga respective DSM agent A and B, reside on different clustered nodes Aand B, and access a common shared storage;

FIG. 14 is a flow diagram of a procedure for allocating a data segment,according to one embodiment of the invention;

FIG. 15 is a flow diagram of a procedure for de-allocating a datasegment, in accordance with one embodiment of the invention;

FIG. 16 (in two parts) is a flow diagram of a procedure for retrieving adata segment for usage, in accordance with one embodiment of theinvention;

FIG. 17 is a flow diagram of a procedure for releasing usage of aretrieved data segment, in accordance with one embodiment of theinvention; and

FIG. 18 is a flow diagram of a procedure for determining the latestcontents of the data segment.

FIG. 19 shows schematically a system for implementing transactionalprocessing for a clustered file system in accordance with one embodimentof the invention in which clustered nodes A and B each include a CFSagent A and B (respectively) and access a common shared storage;

FIG. 20 is one embodiment of a data structure for a transaction journal;

FIG. 21 is a flow diagram of a procedure for committing a transaction,according to one embodiment of the invention;

FIG. 22 is a procedure for checkpointing modified and committed datasegments, in accordance with one embodiment of the invention;

FIG. 23 is a procedure for creating a shadow data segment, in accordancewith one embodiment of the invention;

FIG. 24 is a flow diagram of a procedure for rolling-back a transaction,in accordance with one embodiment of the invention;

FIG. 25 is a flow diagram of a procedure for recovering committedtransactions of failed nodes, in accordance with one embodiment of theinvention; and

FIG. 26 is a flow diagram of a procedure for writing a data segment toits final location upon transferring ownership, in accordance with oneembodiment of the invention.

DETAILED DESCRIPTION

In accordance with various embodiments of the present invention, systemsand method for transactional processing are provided within a clusteredfile system (CFS) which utilizes a distributed shared memory (DSM). Forease of understanding, various embodiments of the DSM and CFS will firstbe described separately (Sections A and B), followed by a description ofvarious embodiments of the transactional processing (Section C).

A-1. Distributed Shared Memory (DSM)

Various embodiments of a DSM algorithm and technology will now bedescribed which assume an unreliable underlying message passing layer.Therefore, uncertainty exists regarding whether a message sent hasreached its designation (possibly with delays) or not, and there is nofeedback provided on the fate of each message. It is further assumedthat there is no order on the reception of messages relative to theorder of their generation or sending. Given these assumptions, the DSMalgorithm is able to efficiently maintain memory coherency.

In understanding the described embodiments, the following definitionsmay be useful:

-   -   Computer cluster. A group of connected computers, assumed in        various embodiments to be working together and thus forming in        several respects a single computational unit; such clusters        typically provide improved performance and/or availability.    -   Distributed shared memory. A technology providing an abstraction        that allows users to view a physically distributed memory of a        distributed system as a virtual shared address space.        Abbreviation: DSM.    -   Memory coherency. The integrity of data stored in the        distributed memories comprising a virtual shared memory.        Generally, all users accessing the virtual shared memory,        performing both read and write operations, must be provided with        a consistent and serialized view of the data stored in the        virtual shared memory.    -   User of a distributed shared memory. A procedure that uses DSM,        and is executed by a specific thread of operation within a        computer application.    -   Data segment. A memory unit of arbitrary fixed or variable size.        The entire memory space of a DSM is partitioned into data        segments.    -   Permission to access a data segment. A user may obtain        permission to access a specified data segment, atomically with        respect to all other users on all nodes sharing the DSM. The        permission may be shared, namely the data segment may be only        read. This permission can be obtained concurrently by multiple        users with respect to a data segment. Alternatively the        permission may be exclusive, namely the data segment may be also        modified. This permission is mutual exclusive with all other        users with respect to a data segment. A valid permission is        either a shared or an exclusive permission.    -   Mutual exclusion. Conditions according to which users are either        permitted to access data segments or alternatively blocked, due        to access permissions concurrently held by other users.        Specifically, a request for shared access permission on a data        segment must block as long as there is a user holding an active        exclusive access permission on that data segment, or there is a        pending user waiting for exclusive access permission on that        data segment (under certain conditions). A request for exclusive        access permission on a data segment must block as long as there        is another user with an active permission on that data segment.    -   Upgrade of permission. An operation of switching from no        permission to shared or exclusive permission on a data segment,        or switching from shared permission to exclusive permission on a        data segment.    -   Ownership of a data segment. Each data segment is owned at any        given time by no more than one of the DSM agents. The identity        of the owner of each data segment (i.e. local or remote) is        recorded by each agent in the data segment's entry. Ownership of        a data segment may be transferred to another node, as a result        of processing user requests. The owner of a data segment        serializes processing of requests issued in parallel for that        data segment, and has complete knowledge on the whereabouts of        the latest contents of that data segment. When a user requires        an upgrade of permission on a specific data segment, a request        must be issued to the owner of that data segment if the owner is        remote.    -   Message passing. A form of communication, commonly used in        distributed and clustered computing, based on sending of        messages to recipients.    -   Messaging session. A communication between the DSM agents, with        regard to a data segment, comprising a request message from        agent A to agent B and a subsequent response message from agent        B to agent A. A messaging session is terminated upon reception        of a response from the other agent or when the operation within        which the request was sent times out. A single messaging session        is allowed per data segment at a time.        A-2. DSM Agents, Table Entries, Data Fields, and Permissions

In accordance with one embodiment, the DSM technology (FIG. 1) consistsof two agents 10 (DSM Agent A) and 12 (DSM Agent B), each residing on adifferent one of the clustered nodes A and B (6, 8 respectively), eachnode having a set of local applications (users) 1 to N (7, 9respectively), and each agent using a local set of memory data segments14, 16 and an associated table of entries 15, 17, wherein each datasegment is associated with an entry. The DSM agents A and B each haveprocedures 2, 4 for handling their respective local requests 7, 9, i.e.,issued by local users (applications) 1 through N, and procedures 3, 4for handling remote requests (from the other agent) via an unreliablemessage passing layer 1 [Therese: My understanding is that the messagepassing layer is unreliable but the proposed protocol is reliable].

The entire memory space of the DSM is partitioned into data segments ofarbitrary fixed or variable sizes. A user may obtain permission toaccess a specified data segment, atomically with respect to all otherusers on all nodes sharing the DSM. The permission may be shared, namelythe data segment may be only read. This permission can be obtainedconcurrently by multiple users with regard to a data segment.Alternatively the permission may be exclusive, namely the data segmentmay be also modified. This permission is mutual exclusive with all otherusers with regard to a data segment. A valid permission means eithershared or exclusive permission. The latest permission for each datasegment is recorded by each agent 10, 12 within its respective table ofentries 15, 17. Permissions are modified only due to user requests.

Each data segment has an owner, which is set to be one of the two DSMagents 10, 12. The owner's identify for each data segment (i.e. local orremote) is recorded by each agent in the data segment's entry (in tables15, 17). When a user requires an upgrade of permission on a specificdata segment, a request must be issued to the owner of that data segmentif the owner is remote. The owner of a data segment serializesprocessing of requests issued in parallel for that data segment, and hascomplete knowledge on the whereabouts of the latest contents of thatdata segment. Ownership of a data segment may be exchanged between theagents, triggered by processing of user requests, in the followingcases: a) when a user is given exclusive permission on a data segment,the agent of its node is set to be the owner of that data segment; b)when a user is given shared permission on a data segment and the remoteowner does not have any permission on that data segment, the agent ofthe node of the requesting user is set to be the owner of that datasegment.

To facilitate the DSM algorithm, each DSM agent maintains a local tableof entries. An example of a data structure 25 for the DSM table ofentries is illustrated in FIG. 2. Each entry is associated with a datasegment, and consists of the following data fields:

-   -   Owner—indicates whether the current owner of the data segment is        local or remote;    -   Permission—indicates the local permission on the data segment        (may be none, shared or exclusive);    -   Copies—set to true if the local agent is the owner of the data        segment and the remote agent has a copy of the data segment,        otherwise set to false;    -   Usage—indicates the number of users currently using the data        segment on the local node. This counter is incremented when a        user receives a permission on the data segment, and decremented        when a user having a valid permission notifies on termination of        usage.    -   Pending Exclusives—indicates the number of pending exclusive        requests on the data segment on the local node. This counter is        desirable in order to avoid starvation of users requesting        exclusive permission, in a case where there is an endless stream        of sequential users requesting shared permission. When a user        requesting an exclusive permission has to block due to mutual        exclusion, this counter is incremented thus informing other        users on this pending request, and decrements this counter after        clearing mutual exclusion. Users requesting shared permission        block in certain conditions if this counter is non-zero.

Additional fields, described herewith, are used to facilitate detectionand resolving of messaging deadlock situations, and to recover thelatest contents of data segments, as elaborated in the next sections:

-   -   Message Out—indicates the type of request message concerning the        data segment that was sent to the remote agent and not responded        yet. If there is no ongoing messaging session, this field is set        to a null value.    -   Message Id Local, Message Id Remote—indicate the latest ids of        messages, concerning the data segment, generated by the local        agent and received from the remote agent correspondingly.    -   Data Segment Version—indicates the version number of the data        segment contents stored at the local agent.    -   No Owner Deadlock Resolving Indication—used to prevent redundant        deadlock resolving threads for a data segment which is in a        state of no owner.

To facilitate efficient scalability in terms of the number of datasegments managed by the DSM agents, the table of entries should becompact, meaning that the values of each field are encoded so that eachfield is allocated with a minimal number of bits.

Each entry is also augmented with four synchronization mechanisms. Onemechanism facilitates mutual exclusion for accessing the entry's fields.The other three mechanisms enable synchronized blocking and awakeningfor users that identify mutual exclusion conditions that necessitatetheir blocking; more specifically, one is for users seeking sharedpermission, a second is for users seeking exclusive permission, and athird is for users that identify an ongoing messaging session.

When a user requires a permission, which entails upgrading the currentpermission held by its local agent on the requested data segment(upgrading means switching from no permission to shared or exclusivepermission on a data segment, or switching from shared permission toexclusive permission on a data segment), a message may be sent to theremote agent to coordinate processing of the request. There are fourtypes of messages between DSM agents:

-   -   Permission request: Sent from a non-owner agent to the agent        holding ownership of a data segment, in order to upgrade        permission on that data segment.    -   Permission response: Sent from an agent holding ownership of a        data segment to the remote agent, granting to the remote agent        the requested permission.    -   Invalidation request: Sent from an agent holding ownership of a        data segment to the remote agent, in a case where the owning        agent requires to upgrade its permission from shared to        exclusive, and the remote agent may hold valid copies of that        data segment.    -   Invalidation response: Sent from a non-owner agent to the agent        holding ownership of a data segment, acknowledging invalidation        of the requested data segment.        FIG. 3 illustrates one embodiment of data structures 26 for each        of these requests and associated responses for DSM messaging.

When processing a request for permission from a local or remote user(via a message), the handling procedure must first check for anyconditions that entail it to block, and it may not proceed until theblocking conditions are cleared. One condition for blocking is mutualexclusion. Namely, a request for shared access permission on a datasegment must block as long as there is a user holding active exclusiveaccess permission on that data segment, or there is a pending userwaiting for exclusive access permission on that data segment (thisapplies under certain conditions). A request for exclusive accesspermission on a data segment must block as long as there is another userwith an active permission on that data segment. In addition to mutualexclusion conditions, a handling procedure must block as long as thereis an ongoing messaging session (indicated by the Message Out field). Amessaging session is terminated upon reception of a response from theremote agent or when the operation within which the request was senttimes out. This enables to maintain a single messaging session per datasegment at a time.

Further details of the DSM handling procedures are explained below.

A-3. DSM Handling Procedures

Several handling procedures are defined within the DSM algorithm. Theseprocedures are described below with reference to FIGS. 4-7.

A procedure 40 for handling a request of a local user for sharedpermission (FIG. 4) checks 42 first the blocking conditions, asspecified earlier, and blocks 44 until these conditions are cleared. Ifownership is determined 46 to be local, a shared permission is grantedby the local agent and the usage count is incremented by one 48 and theprocedure terminates 50. If ownership is determined 46 to be remote andthe local agent is determined 52 to hold shared permission on the datasegment, the usage count is incremented by one 48 and the procedureterminates 50. If ownership is determined 52 to be remote and the localagent does not hold a valid permission, a message is sent 54 to theremote agent requesting shared permission on that data segment. When aresponse is received, with the latest data segment contents, sharedpermission is granted and the usage count is incremented by one 56.According to the response, ownership of the data segment may be alsotransferred 58. In this case the local agent records its ownership andthe copies indication is set 60 to true if the remote agent keeps sharedpermission or false otherwise, and the procedure terminates 50.

A procedure 70 for handling a request of a local user for exclusivepermission (FIG. 5) checks 74 first the blocking conditions, asspecified earlier, blocking 76 until these conditions are cleared. Thepending exclusive counter is incremented 72 before checking theseconditions and decremented 78 after clearing them. If ownership isdetermined 80 to be local and it is determined that 82 the local agenthas an exclusive or no permission or shared permission without copies ofthe data segment, then an exclusive permission is granted 84 by thelocal agent and the usage count is incremented by one 84, and theprocedure terminates 86. If ownership is determined 80 to be local andthe local agent has a shared permission with copies, then a message issent 88 to the remote agent requesting to invalidate its copies. Uponreception of a response 88 the copies indication is set 90 to false, anexclusive permission is granted by the local agent and the usage countis incremented by one 84 and the procedure terminates 86. If ownershipis determined 80 to be remote, a message is sent 90 to the remote agentrequesting an exclusive permission on the data segment. Upon receptionof a response 90, with the latest data segment contents, an exclusivepermission is granted (resetting the copies field), ownership is set tothe local agent and the usage count is incremented by one 92, and theprocedure terminates 86.

A procedure 100 for handling a local user notification of termination ofusage of a data segment (FIG. 6) decreases by one the usage count ofthat data segment 102. If the permission on that data segment isdetermined 104 to be shared and it is determined 106 that the new valueof the usage count is zero and there is a non-zero number of pendingexclusive requests, then a single blocked user that issued an exclusiverequest on that data segment is awakened 108, and the procedureterminates 112. If the permission on that data segment is determined 104to be exclusive then all blocked users that issued a shared request anda single blocked user that issued an exclusive request (if it exists) onthat data segment are awakened 110, and the procedure terminates 112.

A procedure 120 for handling a message sent by a remote user requestingpermission on a data segment (FIG. 7) checks 124 first the blockingconditions, as specified earlier, blocking 125 until these conditionsare cleared. If the request is for exclusive permission, the pendingexclusive counter is incremented 122 before checking these conditionsand decremented 126 after clearing them. A response is then sent 130 tothe requesting agent and the data segment's entry is updated 132, basedon the following calculations 128. Ownership is transferred if therequest is for exclusive permission, or the request is for sharedpermission and the local agent does not have a valid permission on thedata segment. The copies field is reset if the ownership is transferred.The local permission is invalidated if the request is for exclusivepermission or there is no current valid permission. Otherwise the localpermission is set to shared. The data segment contents is sent if thereis current valid permission on that data segment. In addition, in casethe request is for exclusive permission blocked users are awakened 134,and the procedure terminates 136, so that one of the unblocked usersshall send a request to the remote owner.

The procedure for handling a message sent by a remote user requestinginvalidation of a shared permission on a data segment checks first theblocking conditions 124, as specified earlier, blocking 125 until theseconditions are cleared. The pending exclusive counter is incremented 122before checking these conditions and decremented 126 after clearingthem. However, since there may be a deadlock between an invalidaterequest (from owning agent to non-owning agent) and a permission request(from non-owning agent to owning agent), the procedure handling theinvalidation request is defined to resolve such a deadlock, by avoidingblocking due to an ongoing messaging session in case such a deadlock isidentified (the method for identification is specified in the followingsections). After clearing the blocking conditions the local permissionis invalidated, blocked users are awakened, so that one of them shallsent a request to the remote owner, and a response acknowledging theinvalidation is the sent to the requesting agent.

A-4. Support of Unreliable Message Passing

Because real-life message passing technologies are unreliable, assumingfull reliability of an underlying message passing technology wouldexpose a DSM technology to a non-zero probability of data corruption.The DSM algorithm and technology of the present embodiment supportsunreliable message passing technologies. It assumes complete uncertaintyon whether a message that is sent reaches its destination (possibly withdelays) or not, and assumes there is no feedback on the fate of eachmessage. It further assumes no ordering on the reception of messagesrelative to the order of their generation or sending. Given theseassumptions, the present DSM algorithm efficiently maintains consistencyboth of user and internal data, and does not require additional messagesnor run-time for this support.

Given an underlying unreliable message passing technology, the followingproblems arise and should be resolved:

-   -   a) Ownership of a data segment may be lost when a message, sent        in response to a permission request, carries a transfer of        ownership and the message is lost or delayed. Note that the        agent sending such a response waives its ownership regardless of        the fate of the response. Since most operations require a valid        owner for a data segment, the owner should be recovered;    -   b) It must be ensured that a data segment never has two owners,        since such a situation may cause data corruption; and    -   c) Since the owner of a data segment has complete knowledge of        the whereabouts of the latest contents of the data segment, if        ownership is lost this knowledge is also lost, and should be        recovered.        A-5. Recovering Ownership of a Data Segment

Consider the first and second problems. When ownership of a data segmentis lost, the present DSM algorithm employs the following protocol forrecovering the ownership, ensuring that there are no two owners of adata segment. In the initial state both agents are not owners of theconsidered data segment, and thus assume that the other agent is theowner. The basic idea is that ownership can not be taken by an agent; itcan only be given by the other agent. When an agent receives a requestaddressed to the owner of a data segment (i.e. a permission request),and that agent is not recorded as the owner in its local entry of thedata segment, it deterministically concludes that there is currently noowner of that data segment cluster-wide, and it gives ownership of thatdata segment to the other agent within the response it sends. If thisresponse reaches the other agent, in a time frame by which the user thattriggered sending the request is still waiting for the response, theagent that receives the response becomes the new owner of the datasegment. In case a response is received when the user that triggeredsending the request is no longer waiting for the response (i.e. the usertimed out), this response is discarded, regardless of its contents.

This protocol ensures that a data segment never has two owners, since itis impossible that the two agents receive ownership of a data segmentfrom each other at the same time, as further elaborated. Recall that anagent may send only one request per data segment at a time. Consider thefollowing four (4) cases illustrated in FIG. 8:

Case 1 (140): Agent A 142 sends a request 144 that reaches agent B 146before B sends any request on that data segment. In this case agent Bsends a response 148 (giving ownership to agent A), that reaches agent Awhile the relevant user is still waiting 150 for the response (arequesting local user of A has not timed out). Agent A becomes the newowner 152, and agent B remains not an owner 154.

Case 2 (160): This case is similar to case 1, except that the response168 sent by agent B 166 reaches agent A 162 after the wait period 170 ofthe relevant user has timed out, thus the response 168 is discarded 169.Therefore, both agents are not the owners 172, 174 of the data segment.

Case 3 (180): Agent A 182 sends a request 184 that reaches agent B 186after B sends a request 196 on the same data segment. Both requests 184,196 become blocked on the remote side as their handling proceduresidentify an ongoing messaging session. One of the two users thattriggered sending the requests times out and the agent of the timed outuser eventually processes the request of its counterpart agent and sendsa response. Assume without loss of generality that the user timing out190 is affiliated with agent A, the response 198 reaches the useraffiliated with agent B before timing out 199, in which case only agentB becomes the owner 194, since agent A shall discard 197 the response188 to the original request 184 of agent A.

Case 4 (200): This case is similar to case 3, except that the response218 from agent A 202 reaches the user affiliated with agent B 206 aftertiming out 219, in which case both responses 218, 208 sent by bothagents are discarded 215, 217 by their remote agents. Therefore bothagents are not the owners 212, 214 of the data segment.

A-6. Resolving a No Owner Messaging Deadlock

In the scenario of case 4, both agents 202, 206 send concurrentpermission requests 204, 216 on a same data segment not owned by both,and both responses 208, 218 are discarded 217, 215, thus failing bothrequests and failing to recover ownership of that data segment 212, 214.This scenario is referred to as a no owner messaging deadlock. Datasegments that are accessed with high contention from both agents, forwhich ownership is lost, may exhibit sequentially repeating occurrencesof this scenario, thus detrimentally affecting performance. To improveperformance the DSM algorithm of the present embodiment employs aprocedure 220 illustrated in FIG. 9 which deterministically detectswhether such a deadlock occurs, and upon detection one agent resolvesthe deadlock. Noting that detection of such a deadlock must bedeterministic; otherwise both nodes may receive ownership of a datasegment, causing data corruption.

As shown in FIG. 9, such a deadlock is detected by an agent A when, uponreceiving 222 and processing 224-236 a message of agent B requestingpermission on a data segment P, the following conditions are determinedto be true:

-   -   a) Agent A is not the owner of data segment P (determining step        226 based on the entry's owner field);    -   b) There is currently an ongoing messaging session requesting        permission on data segment P (determining step 224 based on the        entry's message out field);    -   c) Agent B did not see agent A's permission request message        before sending its permission request message (determining step        228 based on the entry's message Id field);

While the calculations of conditions a and b are more straightforward,the calculation and associated logic required for condition c requiressome elaboration, which is given in the next section.

Upon detection of such a deadlock, only one predetermined agent(determining step 230), and only a single user operating via the onepredetermined agent on data segment P (determining step 232 based on theentry's no owner deadlock resolving indication field) may enter thedeadlock resolving protocol. The handling procedure of this single userwithin the predetermined agent avoids waiting for completion of themessaging session, and sends 234 a response, thus resolving thedeadlock, and the procedure thereafter terminates 236. Meanwhile, theother users operating via both agents have waited 238 for completion ofthe messaging session.

A-7. Detection and Resolving of Messaging Deadlocks

Messages arrive at their destination with an arbitrary order relative tothe order in which they were generated or sent. A messaging deadlocksituation occurs when both agents concurrently send a request message onthe same data segment before seeing the requests of their counterparts.Since processing of all local and remote requests on that data segmentis blocked until the messaging sessions complete, such a sequencecreates a messaging deadlock.

There are two types of messaging deadlocks in the context of the presentDSM algorithm. One type is the no owner messaging deadlock described inthe previous section. Another type is a deadlock termedpermission/invalidation messaging deadlock, where the agent set as theowner of a data segment requires to upgrade the data segment'spermission from shared to exclusive, and the non-owning agent alsorequires to upgrade the data segment's permission. Thus, the owningagent sends an invalidation request, and the non-owning agent sends apermission request. If both requests are sent before receiving andseeing the remote agents' requests, a deadlock is formed.

To identify messaging deadlocks, the present DSM algorithm employs amessage id mechanism described herewith. Note that identification of thedeadlock must be deterministic, otherwise data corruption may occur.Each agent maintains two message ids for each data segment—one id forthe local agent and the second id for the remote agent. When an agentgenerates a message, an associated locally unique message id isgenerated and recorded in the message id local field of the datasegment's entry. Messages are augmented with the values of the messageids (local and remote) stored in the relevant data segment's entry. Whena message from the remote agent is handled by the local agent, themessage id remote field of the data segment's entry is set by the localagent to equal the id of that message, thus signifying the latestmessage of the remote agent that was seen by the local agent.

Detection of messaging deadlocks is done within the procedures thatprocess messages from the remote agent (see FIG. 9). The agents use themessage ids stored in the data segment's entry (see FIG. 2) and receivedwith the message to determine whether or not the remote agent saw thelatest message sent by the local agent before sending its message.Specifically if the local message id is different than the local messageid sent with the message from the remote agent, meaning that the remoteagent did not see the message sent by the local agent before sending itsmessage, then a deadlock is identified.

When a deadlock is identified, one of the agents, determined dynamicallyor statically (depending on the type of deadlock as described next),avoids waiting for the remote agent's response, thus resolving thedeadlock. In a no owner messaging deadlock the resolving agent ispredefined statically. In a permission/invalidation messaging deadlockthe resolving agent is the one processing the invalidation requestmessage (namely, the agent that sent the permission request message, andis the non-owning agent).

An additional use of the message id mechanism is for pruning obsoletemessages (illustrated by the procedure 240 shown in FIG. 10). Sincemessages arrive and are transferred for processing in an arbitrary orderrelative to their generation and sending, an agent may receive obsoletemessages which should not be processed. If such a message is processedownership may be lost, if the remote user that generated this messagehas already timed out. Therefore, upon reception of a message (step242), and after waiting to clear any blocking conditions of an ongoingmessaging session or mutual exclusion (step 244), the receiving agentdetermines (step 246) that the message is obsolete if the remote messageid conveyed with the message is of a smaller order than the remotemessage id stored in the data segment's entry. If the message isdetermined to be obsolete, it is discarded and processing completes(step 250). Otherwise, the receiving agent processes the remote agent'srequest and sends (step 248) a response, which completes the process(step 250).

Message ids should be locally unique in order to support the no ownermessaging deadlock, and should further enable ordering of the messagesrelative to their order of generation in order to support pruning ofobsolete messages. These message ids should be allocated with sufficientsize, so that a complete cycle of these ids including wrap-around ispractically impossible with regard to the frequency of messagingsessions. Avoiding wrap-around should also be considered whencalculating the difference between the values of message ids.

A-8. Recovering the Latest Data Segment Contents

When the ownership of a data segment is lost, the knowledge on thewhereabouts of the latest contents of the data segment, normally storedwith the owner, is also lost. Therefore, as part of the ownershiprecovery algorithm, specified in the previous sections, the latestcontents of the data segment should be also identified and restored. Aprocedure for this purpose is illustrated in FIG. 11.

The computation for determining the location of the latest contents of adata segment with no owner is done within the procedure that processes apermission request message from the remote agent (e.g., the steps 262and 264 of receiving a permission request from a remote agent andwaiting to clear any blocking conditions of an ongoing messaging sessionor mutual exclusion). As further illustrated in FIG. 11, if the localagent determines (step 266) that it has a valid permission on the datasegment, then the data segment's contents available to the local agentis latest, thus deterministically identified, and this contents can besent (step 271) to the remote agent with the response (step 272) givingownership, thus restoring the latest data segment's contents, andcompleting the process (step 274). Otherwise, step 266 determines thereis no valid permission locally, and the latest contents of the datasegment may be at either side. In this case data segment versionnumbers, maintained by each agent for each data segment, and conveyedwith messages, are compared (step 268). The responding agent comparesthe data segment version number conveyed with the message to its owndata segment version number, and determines that the data segmentcontents available locally is latest if the local version number is morerecent than the version number sent by the remote agent. Only in thiscase the responding agent sends (step 271) its data segment contents tothe remote agent; otherwise the responding agent does not send (step270) its data segment contents.

Preferably, so that a data segment entry is highly compact, the datasegment version number field is allocated with a minimal number of bits.Small version number fields (e.g. 2 bits) with fast wrap-around requirea special method for maintaining them, specified herewith. Data segmentversion numbers are maintained so that when both agents have the samedata segment contents their associated version numbers shall beidentical; and when an agent updates a data segment, its version numbershall be different (e.g. larger by one) than the version number storedby the remote agent. One embodiment of a method for setting the valuesof a data segment version number is described as follows.

When an agent upgrades its permission on a data segment from shared toexclusive, the data segment version number stored with that agent is setto equal a value larger by one relative to the version number storedwith the remote agent. When an agent upgrades its permission on a datasegment to shared permission, the data segment version number storedwith that agent is set to equal the version number sent by the remoteagent. The specifics of this method are further elaborated below.

In the case where the ownership is local and there is no permission onthe data segment, regardless of the requested permission, the datasegment version number is incremented by one relative to the storedversion number.

In the case where the request is for shared permission: If ownership isremote and the data segment contents has been conveyed with the responsemessage (meaning that the remote agent's contents is latest) and theremote agent keeps its shared permission, then the data segment versionnumber is set to the remote agent's data segment version number conveyedwithin the message. Otherwise, if the remote agent does not keep a validpermission, then the data segment version number is incremented by onecompared to the remote agent's version number.

In the case where the request is for exclusive permission: If theownership is local and the current permission is shared and the remoteagent has a copy of the data segment, then an invalidation request issent to the remote agent and responded, to subsequently setting the datasegment version number to a value larger by one than the version numberconveyed with the remote agent's response. If the remote agent does nothave copies (i.e. no invalidation request is sent), then the datasegment version number is not modified, since there is already adifference of one between the local and the remote version numbers.Further elaborating, there are no copies due to either a previousexclusive permission request or invalidation request sent from theremote agent, or a previous shared permission request of a local userupgrading from no permission (where ownership is local)—in all cases theversion number was already incremented. If ownership is remote and apermission request message is sent to the remote agent, then regardlessif the data segment contents is sent with the response from the remoteagent, the data segment version number is set to a value larger by onethan the version number conveyed with the remote agent's message (thuscreating a difference of one), since an exclusive permission is granted.

A-9. Modifying the Data Segment Entry after Sending a Response Message

Consider a procedure (e.g. FIG. 7) that processes a permission requestmessage sent from the remote agent. After this procedure sends aresponse message to the remote agent, it must modify the data segment'sentry to its new state, regardless of the unknown fate of the message.However, since this procedure features the method for resolving the noowner messaging deadlock (FIG. 9), operating concurrently with otheroperations, caution is exercised with regard to updating the datasegment's entry, and it is modified in the following two cases.

As illustrated in FIG. 12, in a procedure for handling a permissionrequest from a remote agent (steps 282-286), if it is determined (step288) that this procedure does not activate the deadlock resolvingmethod, then the entry is updated (step 291) and the process terminates(step 294). If it is determined (step 288) that this procedure activatesthe deadlock resolving method and it is determined (step 290) that aconcurrent procedure operating on the same data segment has not yetreached the point of updating the data segment's entry, then the entryis updated (step 291), otherwise the deadlock resolving procedure doesnot update (step 292) the data segment's entry. This way, a deadlockresolving procedure does not override modifications made by a procedurethat does not activate this method. This avoidance is required, sinceeither the deadlock was indeed resolved by the deadlock resolvingprocedure, or the response it sent was no longer awaited for—in bothcases its subsequent update of the data segment's entry is no longerrequired.

A-10. Summary

There has been described one embodiment of a DSM algorithm andtechnology in a two (2) node cluster that uniquely supports unreliableunderlying message passing technologies. The DSM algorithm assumescomplete uncertainty on whether a message that is sent reaches itsdestination (possibly with delays) or not, and assumes there is nofeedback on the fate of each message. It further assumes no ordering onthe reception of messages relative to their order of generation andsending. Given these assumptions, the present DSM algorithm efficientlymaintains full consistency of both user and internal data.

B-1. Introduction to Distributed Shared Caching for Clustered FileSystems (CFS)

File systems improve the efficiency of storage accesses by using cachingmethods to reduce disk accesses. In clustered (a.k.a. shared disk) filesystems, which provide concurrent read and write access from multipleclustered computers to files stored in shared external storage devices,caches are maintained within each computer. In such an architecturecache coherency, namely the integrity of data stored in the distributedcaches, is a major consideration. Generally, all users accessing thefile system should be provided with a consistent and serialized view ofthe files, avoiding corruption of data. Specifically, a read made by auser U1 to block B that follows a write by a user U2 (which may be thesame or another user) to B must return the value written by U2, if noother writes to B were made between the two accesses. In addition,writes to the same block must be sequenced, namely all users view thevalues written to block B in the order that they were applied. Severalapproaches have been suggested for achieving cache coherency. Aprominent and common approach is the write-invalidate method, where awrite operation to a block B invalidates all the copies of that block inother caches.

In existing clustered file systems the resolution for cache coherency isgenerally a file. As long as a file is not modified, the contents of thefile in all caches is consistent. When a user writes to a file, thecontents associated with this file is invalidated in all other caches,in order to ensure a coherent view for other users. If such invalidationdid not occur other users may receive obsolete contents of that file,thus defying cache coherency. When users read from a file, immediatelyafter it was modified, the contents associated with this file in thecache of the user that performed the write operation is typicallywritten to disk, thus maintaining coherency of the data being read.However, as write operations become more frequent, this cache coherencemethod becomes significantly inefficient, as the probability of cachehits is substantially reduced. For high performance distributed systemsthat employ intensive concurrent read/write access patterns to sharedfiles, existing methods for cache coherency within clustered filesystems result in poor performance.

In accordance with various embodiments of the present invention, amethod is provided for efficient caching, guaranteeing cache coherency,for clustered file systems. In contrast to existing methods, the presentcaching method provides good performance in an environment of intensiveaccess patterns to shared files. In the present method, cache coherencyis achieved based on a resolution of fixed or variable sized andrelatively small (e.g. a few kilo bytes) data segments, rather thanfiles. In this way cache coherency is disassociated from the concepts offiles. Coordination between the distributed caches (includinginvalidation of segments), their coherency and concurrency management,are all done based on the granularity of data segments rather thanfiles. The present method utilizes the distributed shared memory (DSM)technology previously described, for cache management. DSM provides anabstraction that allows users to view a physically distributed memory ofa distributed system as a virtual shared address space. Thus, with thepresent method, when a user writes to a file, only the affected datasegments are invalidated in the other caches, thus tightly bounding themodified regions of data. Consequently, the proposed solution increasesthe probability of cache hits, and maintains high efficiency insituations of intensive access patterns to shared files.

B-2. Architecture of the CFS Caching Method

In the disclosed embodiment, the new method is embedded within a twonode 306, 308 clustered file system 300. FIG. 13 depicts the CFSarchitecture, wherein components corresponding to those in FIG. 1 (theDSM architecture) have been given similar reference numbers (in the 300range). The DSM agents 310, 312 manage access permissions to the entirespace of file system data in a shared storage 320, (e.g., shared diskstorage) including file system metadata 321 and file system user data322, via input/output requests 323. Each of nodes 306, 308 has anassociated set of local users 307, 309, respectively.

The file system logic components 330, 332 (CFS Agents A and B on nodes Aand B respectively) are partitioned into two high level components. Thefirst component 331, 333 manages the storage and the association ofstorage segments to data segments and/or files. It uses file systemmetadata on the shared storage 320 to facilitate its operations, andallocates storage for user data as required. Distinctive from existingclustered file systems, where this component provides users only withthe abstraction of files, in the present architecture this componentprovides also the abstraction of data segments, in addition to theabstraction of files. Such data segments may be provided either groupedby or independent of files. In the former case, files are regarded assets of data segments. The second component 334, 335 manages access toshared storage 320, relying also on the storage management (first)component 331, 333. A main functionality of this second component iscaching to reduce disk accesses. Caching may be applied to both filesystem metadata and user data. In this architecture, efficient andcoherent caching is implemented via an integration of a cache component337, 339 with a DSM component 310, 312 (respectively for each of nodes306 and 308).

The CFS agents 330, 332 each manage a set of data segments in theirlocal cache 337, 339 whose total size is typically significantly smallerthan the capacity of available storage. A data segment in the cache maybe associated with a data segment in the shared storage, or may bedisassociated from any data segment (i.e. available). Data segments inuse are locked in the cache, in the sense that these data segmentscannot be disassociated from their disk data segments. When such datasegments are not used any more, and other disk data segments arerequired for access, they can be disassociated from their disk datasegments, using for example a Least Recently Used mechanism, foreviction from the cache.

The DSM components 310, 312 provide an abstraction that allows thephysically distributed caches 337, 339 within the distributed CFS agents330, 332 of the clustered file system to behave as a shared virtuallyglobal cache. The DSM components manage access permissions to the entirespace of file system data in shared storage 320, while, in contrast totraditional DSM technologies, the DSM agents here do not have aninternal set of memory data segments, rather they are integrated withtheir local cache components 337, 339 that enable to load only a smallrelevant subset of the file system data into cache. The DSM components337, 339 also provide instructions to their associated storage accesscomponents 334, 336 on the required method for obtaining the latestcontents of a data segment specified for retrieval, optionallyretrieving the latest contents via messaging 301 with the remote DSMagent.

Elaboration on the basic operation of the DSM components has beenpresented in the prior sections of this application. Elaboration on theintegrated operation of the DSM component and the cache component withinthe storage access component, is presented in the following section.

B-3. Using DSM for Caching within a Clustered File System

In the context of understanding the following detailed embodiment, thefollowing definitions may be useful (in addition to the definitionspreviously provided in a discussion of the DSM):

-   -   Shared storage. Storage devices that are accessible by multiple        computers.    -   Clustered file system. A file system that provides concurrent        read and write access from multiple clustered computers to files        stored in shared external storage devices.    -   Cache coherency. The integrity of data stored in the distributed        cache memories comprising a virtual shared cache. Generally, all        users accessing the virtual shared cache, performing both read        and write operations, must be provided with a coherent and        serialized view of the data stored in the virtual shared cache.    -   User of a clustered file system. A procedure that uses CFS, and        is executed by a specific thread of operation within a computer        application.

The clustered file system provides a data segment based interface foraccessing files and/or storage. A user may open and close files tonotify on beginning and completion of access to specific files. A usermay perform the following operations in accordance with one embodimentof the invention:

-   -   Allocate a data segment: The user is provided with the address        of the newly allocated disk data segment, and a pointer to a        cache data segment associated with this disk data segment. The        permission on the allocated data segment is set to exclusive.    -   De-allocate a data segment: The user provides the address of a        disk data segment for de-allocation, and the file system        de-allocates that data segment.    -   Retrieve an already allocated data segment with a shared or        exclusive permission: The user provides an address of an already        allocated disk data segment; and the file system grants the        required permission on that data segment, retrieves its latest        contents, loads it into a cache data segment, and returns a        pointer to this cache data segment.    -   Mark a retrieved data segment as modified: The user provides an        address of a retrieved disk data segment, signifying that the        contents of this data segment has been modified and should be        written to disk. The data segment must have been retrieved with        an exclusive permission.    -   Signify on completion of usage of a retrieved data segment: The        user provides an address of a retrieved disk data segment,        signifying on completion of its usage.    -   Write cache data segments that are marked as modified to the        shared storage.

In the remainder of this section, methods of using the DSM and cachecomponents within the procedures that implement the aforementionedfunctionalities are specified.

A procedure 340 for allocating a data segment (FIG. 14) begins byallocating 342 a disk data segment via the storage management component.Then a cache data segment is associated with the newly allocated diskdata segment and locked in cache memory (by incrementing its usagecount) 350. Associating a cache data segment is done in the followingway: If it is determined that 344 there are unassociated cache datasegments, one of them is associated 350 with the new disk data segment.If there are no unassociated cache data segments, and it is determined346 there is an unlocked data segment, then one of the associated andunlocked data segments is used. If such an associated and unlocked datasegments is determined 347 to be marked as modified, then it is written349 to the shared storage before usage. If not, the data segment'scurrent contents is discarded 351. If all cache data segments areassociated and locked, then the cache may be dynamically extended 348.Upon association, the associated cache data segment is cleared 350, andmarked as modified. Following the allocation of a cache data segment, anexclusive permission is acquired 352 on that disk data segment using theDSM component, and the procedure ends 354. There will not be anycontention on the data segment, and the data segment's contents will notbe overwritten by the DSM component, since the data segment in theremote agent's cache is not valid.

A procedure 360 for de-allocating a data segment (FIG. 15) begins byensuring 362 that the disk data segment must not be in shared permissionand in use. The disk data segment must be in an active exclusivepermission before de-allocation. If this is not the case, an exclusivepermission is acquired 363 by the procedure on the disk data segment.This invalidates a corresponding cache data segment in the remoteagent's storage access component, so if the remote agent allocates thisdata segment, its contents in the local cache of that agent will not beconsidered as valid. There must not be any contention on the datasegment. Then, if it is determined that 364 there is a cache datasegment associated with that disk data segment, it is disassociated 365.This is followed by de-allocation 366 of the disk data segment via thestorage management component. Finally, the disk data segment is released367 also via the DSM component, and the process ends 368.

A procedure 370 for retrieving a disk data segment for usage (FIG. 16)begins by examining 372 the cache for the presence of that data segment.If it is determined that 374 this data segment is not associated withany cache data segment, a cache data segment is associated 376 using themethod described within the data segment allocation procedure 371,378-379. Then permission is acquired on the disk data segment via DSMaccording to the user's request 380—shared 381 or exclusive 382. In thiscontext, there is a special case, where a new cache data segment wasallocated, and the request is for shared permission, and there is avalid shared permission on that data segment, and ownership of that datasegment is remote, although normally no message should be sent to theremote agent to acquire permission, in this case a message is sent tothe remote agent to retrieve the latest data segment contents. Uponacquiring permission, an instruction 383 is given by the DSM componenton how to obtain the latest contents of that data segment. There arethree possibilities in this context. The first is that the contents ofthat data segment in the local cache, if it exists, is latest. Thesecond is that the latest contents of that data segment is provided bythe DSM component via communication with the remote DSM agent. The thirdis that the latest data segment contents should be read from disk.Therefore, the data segment contents should be read from disk 385, inthe context of the current procedure, in the following cases: The DSMcomponent instructs to read the latest data segment contents from disk;or the DSM component instructs that the data segment contents in thelocal cache (if it exists) is latest but a new cache data segment wasassociated with the disk data segment within this procedure 384. In anyother case, the disk data segment is not read from disk, and the processends 386.

A procedure for marking a retrieved data segment as modified begins byensuring that there is an active exclusive permission on that datasegment and that there is a cache data segment associated with that diskdata segment. If so, this cache data segment is marked as modified, soit can be flushed to disk within the next flush operation.

Flushing modified data segments to disk may be done by periodic flushoperations, triggered by the user or the file system. The file systemmay decide to flush a set of data segments, when some conditions apply,for example, when the number of cache data segments marked as modifiedexceeds some threshold, or when the number of unassociated data segmentsin the cache is not sufficient. The flushing mechanism may be augmentedwith transactional or journaling support, entailing first flushing themodified cache data segments or a respective representation of theirmodifications to a log or a journal and then flushing these datasegments to their final location in the shared storage. This enablesimproving robustness to failures by preventing data consistencyproblems. The cost entailed is additional write operations involved inflush operations. In addition, upon eviction of modified and unlockeddata segments from cache, such data segments are flushed to the sharedstorage.

A procedure 390 for releasing usage of a retrieved data segment (FIG.17) begins with decrementing 391 the usage counter of the associatedcache data segment. If it is determined 392 that the new usage value iszero, then the cache data segment is unlocked 393 (i.e. it may beevacuated from the cache). Then the disk data segment is released 394via the DSM component, and the process ends 395.

When a DSM agent processes a request from the remote DSM agent, it maybe required to convey the latest contents of a data segment, if presentin the local cache, to the remote agent. To facilitate this the DSMprocedure that processes request messages from the remote agent uses aninterface provided by the local cache component. Such a DSM proceduredetermines with the local cache whether the requested disk data segmentis associated with a cache data segment or not. If the data segment isassociated with a cache data segment and the DSM agent has a validpermission on that data segment, then the DSM agent retrieves it fromthe cache (also locking it in the cache), sends it with the response,and then signifies the cache on completion of usage of that datasegment. Otherwise, the DSM agent does not send that data segment withthe response, signifying the remote storage access component to readthat data segment from disk, and also transfers ownership of that datasegment to the remote DSM agent. In addition, if ownership of arequested data segment is transferred to the remote DSM agent in thiscontext, and that data segment is in the local cache and marked asmodified, then it is flushed to disk, also clearing its modificationmark.

The DSM component, beyond granting the required permissions on disk datasegments, also instructs the storage access component on the appropriatemethod to obtain the latest contents of a data segment being accessed.As previously mentioned, there are three possibilities in this context.The first is that the contents of the data segment in the local cache,if it exists, is latest. The second is that the latest contents of thedata segment is provided by the DSM component via communication with theremote DSM agent. The third is that the latest data segment contentsshould be read from disk. To determine the appropriate method forobtaining the latest contents of a data segment, a procedure 400 (FIG.18) determines whether the following conditions are true:

-   -   If ownership of the data segment is determined 401 to be local        and it is determined that 402 there is no valid permission on        the data segment, then the data segment should be read from the        disk 403, and the process ends 409. If, on the other hand, there        is a valid permission on the data segment (shared or exclusive),        then the data segment's contents in the local cache, if it        exists, is latest 404.    -   If ownership of the data segment is determined 401 to be remote,        then the following conditions apply. If the request is        determined 405 to be for shared permission and the current        permission on the data segment is shared and the data segment        exists in the local cache, then the data segment's contents in        the local cache is latest 404. In any other case, a request        message is sent 406 to the owner of the data segment (i.e. the        remote DSM agent), and the data segment's latest contents is        either transported within the response if it is determined 407        to be in the remote cache and with a valid permission, otherwise        the data segment's latest contents should be read from disk 403.

To increase efficiency of the file system operations, caching integratedwith DSM may be used for both user data and file system metadata.Therefore, the aforementioned procedures may be employed for efficientdisk access also by the internal procedures of the file systemcomponents. To further improve efficiency, the file system metadata maybe partitioned into regions (see regions 321 a and 321 b in FIG. 13),which are assigned to each of the clustered file system agents, suchthat each region is modified by a single file system agent morefrequently relative to other file system agents. Such a partitionalleviates contention on frequently accessed data segments and reducesmessaging traffic for coordination of access.

B-4. Summary of CFS Caching Method

There has been described an efficient method embodiment for caching,guaranteeing cache coherency, for clustered file systems. In contrast toexisting methods, the present caching method provides good performancein an environment of intensive access patterns to shared files. Themethod achieves cache coherency based on a resolution of fixed orvariable sized and relatively small data segments, rather than files. Inthis way cache coherency is disassociated from the concept of files.Coordination between the distributed caches (including invalidation ofsegments), their coherency and concurrency management, are all donebased on the granularity of data segments rather than files. Theclustered file system utilizes the distributed shared memory technologypreviously described, for cache management. With the present method,when a user writes to a file, only the affected data segments areinvalidated in the other caches, thus tightly bounding the modifiedregions. Consequently, the present embodiment increases the probabilityof cache hits, and maintains high efficiency in situations of intensiveaccess patterns to shared files.

C-1. Introduction to Transactional Processing for Clustered File Systems

In accordance with various embodiments of the present invention, amethod is provided for efficient transactional processing, consistencyand recovery within clustered file systems. The new method enables usersto operate on files using a resolution of fixed or variable sized andrelatively small (e.g. a few kilo bytes) data segments. Users areprovided with an interface for utilizing the transactional mechanism,namely services for opening, committing and rolling-back transactions.The operations joined into user defined transactions are operations ondata segments within the file system. The new method utilizes thedistributed shared memory (a.k.a. DSM) technology previously described,that facilitates efficient and coherent cache management (alsopreviously described) within a clustered file system (CFS). DSM providesan abstraction that allows users to view a physically distributed memoryof a distributed system as a virtual shared address space. DSM within aclustered file system enables the CFS to manage and coordinate cachecoherency and concurrency based on the granularity of data segments(rather than files). In this way, when a user writes to a file, only theaffected data segments are invalidated in the local caches of othercomputers (nodes), consequently, increasing cache hits and improvingperformance.

In the various embodiments described below and in the accompanyingfigures, a method for supporting transactional processing is providedwhich uses local journals, one for each computer (node) in the cluster,to record the user defined transactions. Transactions record allmetadata and user data segments affected by the operations they include.The method includes procedures to write data segments into the journalsand then to their final locations, so that concurrency is maintained.The method also includes procedures for rolling-back transactions, andrecovering from system faults, both on-line (i.e. where there areoperational computers in the cluster during the failure), and off-line(i.e. where there are no operational computers in the cluster during thefailure). All these procedures are designed for maximal concurrency andminimal disruption to concurrent work in the cluster, in a mannerdistinctive from existing file systems.

C-2. Architecture of the Transactional Processing Method for CFS

In a disclosed embodiment, the new method is embedded within a two node506, 508 clustered file system 500. FIG. 19 depicts the CFS architecturefor transactional processing, wherein components corresponding to thosein FIG. 13 (the combined DSM and CFS architecture) have been givensimilar reference numbers (in the 500 range). The DSM agents 510, 512manage access permissions to the entire space of file system data inshared storage 520, including file system metadata 521 and file systemuser data 522. Each of nodes 506, 508 has an associated set of localusers 507, 509, respectively.

The file system logic components 530, 532 (CFS Agents A and B on nodes Aand B respectively) are partitioned into two high level components. Thefirst component 531, 533 manages the storage and the association ofstorage segments to data segments and/or files. It uses file systemmetadata on the shared storage 520 to facilitate its operations, andallocates storage for user data as required. Distinctive from existingclustered file systems, where this component provides users only withthe abstraction of files, in the present architecture this componentprovides also the abstraction of data segments, in addition to theabstraction of files. Such data segments may be provided either groupedby or independent of files. In the former case, files are regarded assets of data segments. The second component 534, 535 manages access toshared storage 520, relying also on the storage management (first)component 531, 533. The main functionalities of this second componentare caching to reduce disk accesses, transactional processing, andconcurrency management. These functionalities are applied to both filesystem metadata and user data, and are implemented via integration of atransaction processing component with a caching component 537, 539 and aDSM component 510, 512 (respectively, for each of nodes 506 and 508).

Elaboration on the basic operation of the DSM and CFS components andarchitecture have been presented in prior sections of this applicationand will not be repeated. Elaboration on the integrated operation of thetransaction processing methods with the DSM and CFS caching components,is presented in the following sections.

C-3. Transactional Processing Method within a Clustered File System

In the context of understanding the following detailed embodiment, thefollowing definitions may be useful (in addition to the definitionspreviously provided in discussions of the DSM and CFS):

-   -   Transaction. A transaction is a logical unit of work, that        either takes effect in its entirety or takes no effect at all. A        transaction is isolated from other transactions, namely not        operation external to the transaction can view the data in an        intermediate state. Furthermore, upon successful completion a        transaction is durable and guaranteed to survive system        failures.

Each computer (node) in the cluster is associated with a dedicated,possibly cyclic, transaction journal, which stores committedtransactions generated by users on that computer. Write operations tothe transaction journal may include several data segments at once, andtheir size is optimized to the underlying storage device.

FIG. 20 illustrates one example of a structure of a transaction journal540. It begins with a header data segment 541 containing identificationinformation, the identifier of the last transaction contained in thejournal, and pointers to the beginning and ending of the transactioncontents within the journal. The header data segment is followed bytransaction data segments for an exemplary transaction X. Eachtransaction begins with a list 542 of data segment identifierscomprising the transaction, followed by the data segments 543 a, 543 b,543 c, . . . themselves, and terminated with a data segment 544indicating the end of the transaction record. Additional transactions545 (abbreviated) and another transaction Y (546) are listed belowtransaction X in FIG. 20.

In the transaction processing method, user operations are applied todata segments in the cache; data segments are read to the cache, andoptionally modified in the cache. A commit operation, signifying asuccessful termination of the transaction, writes the modified datasegments (metadata and user data) to the transaction journal associatedwith the computer on which the transaction is processed. A checkpointoperation writes the modified data segments to their final location inthe shared storage. A roll-back operation, signifying cancellation ofthe current transaction, reads data segments from the transactionjournal associated with the computer on which the transaction isprocessed, to restore the cache to its state prior to that transaction.On-line and off-line recovery operations, where a computer recovers thefile system due to failures of other computers in the cluster, eitherduring normal work or before normal work starts (correspondingly), readdata segments from the transaction journal of the failed computers, tosubsequently write them to their final location in the shared storage.

In accordance with various embodiments of the present invention,transactions are initiated by multiple users and processes concurrentlyby the file system. Specifically, transactions that update disjointportions of the file system are processed concurrently, whiletransactions that share updated portions are serialized. Usersperforming read only operations are allowed to access the file systemconcurrently, while users performing transactions are serialized withall and only the users that require access to the same file systemportions affected by these transactions. To achieve serialization andisolation of transactions sharing the same updated portions of the filesystem, each transaction takes exclusive permissions on all datasegments it modifies, and releases these permissions only upontermination of the transaction (via commit or roll-back). Transactionsare globally ordered, across the cluster, according to their terminationtime.

To facilitate this, a transaction is allocated with an identifier at thetime of its commit operation, atomically with the release of permissionson the data segments involved in the transaction. The identifier isimplemented with a DSM component, to ensure a coherent view of this dataacross the cluster. Thus, transaction A precedes transaction B,according to their identifiers, if and only if A terminated before B.This global ordering method, coupled with release of permissions onlyupon transaction termination, ensures that if transactions A and B sharea set of data segments S, and A's identifier is smaller than B'sidentifier, then the contents of the data segments of S associated withtransaction B is more recent than the contents of the data segments of Sassociated with transaction A (since B blocked when trying to acquirepermission on a data segment of S that A already acquired, and resumedonly after A terminated). Within the metadata of each data segment,written in its final location in the shared storage and in thetransaction journals, the identifier of the transaction that generatedthe contents of that data segment is also recorded. Thus, thetransaction identifiers provide ordering on the recentness of thecontents of data segments.

The basic operations of the CFS have previously been described, e.g.,procedures for allocating a data segment (FIG. 14), de-allocating a datasegment (FIG. 15), and retrieving a data segment for usage (FIG. 16),and marking a retrieved data segment. In the context of transactionalprocessing, the following additional procedures will be described.

In the procedure for allocating a new data segment, after allocating adisk data segment and associating a cache data segment with the newlyallocated disk data segment, also marking it as modified, that cachedata segment and all other metadata data segments that were modified inthe process of allocating the data segment are inserted into a list ofdata segments modified within the associated transaction.

In the procedure for de-allocating a data segment, after acquiring anexclusive permission on the de-allocated data segment and de-allocatingthe data segment, removing that data segment from the list of datasegments modified within the associated transaction, if it exists there,and inserting all metadata data segments that were modified in theprocess of de-allocating the data segment into that list.

In the procedure for retrieving a disk data segment for usage, checkingif there is an existing cache data segment associated with the requesteddisk data segment, and whether this cache data segment was dispatched tobe written to its final location within an asynchronous checkpointprocess which is still underway, and whether the user requires anexclusive permission on that data segment (i.e. the data segment may bemodified). If these conditions hold then a shadow data segment iscreated in cache and provided to the user. A shadow data segment isidentical in contents to the original data segment, and enables the userto modify the data segment, while its original replica is being writtento its final location. Upon completion of the asynchronous checkpointprocess, the original cache data segment is disassociated with the diskdata segment, and the shadow data segment becomes the solerepresentation of the disk data segment in the cache.

In the procedure for marking a retrieved data segment as modified, aftermarking the associated cache data segment as modified, inserting thatcache data segment into a list of data segments modified in theassociated transaction, accompanied with an indication of whether thisdata segment was marked as modified before this operation (this is usedin the procedure implementing roll-back).

The clustered file system also provides the users with an interface foroperating the transactional processing mechanism:

-   -   Open a transaction: With this operation the user requests to        begin a new transaction, and may do so upon completion of this        operation.    -   Commit an ongoing transaction: With this operation the user        requests a successful termination of an ongoing transaction.        Upon completion of this operation it is guaranteed that the        contents of that transaction is permanently applied to the file        system, regardless of any fault that may occur after completion.    -   Roll-back of an ongoing transaction: With this operation the        user requests cancellation of an ongoing transaction. Upon        completion of this operation it is guaranteed that the file        system is restored to its state before the beginning of that        transaction.

In addition, the clustered file system implements the followingprocedures for operating the transactional processing mechanism:

-   -   Checkpoint: Writes data segments of committed transactions to        their final location in the shared storage.    -   On-line and off-line recovery: Restore the consistency of the        file system, after failure of a computer in the cluster, to its        most recent consistent state, either on-line (i.e. during normal        work) or off-line (i.e. without normal work), correspondingly.

In the rest of this section, the transactional processing method isspecified in the context of each procedure implementing the abovedescribed operations.

A procedure for opening a transaction allocates a list structure thatshall record the data segments involved in the transaction (e.g. FIG.20).

A procedure 550 for committing an ongoing transaction (FIG. 21) beginsby assigning 551 a unique transaction identifier, larger than allprevious identifiers (existing in the file system). It then allocates552 the required space in the transaction journal associated with thecomputer on which the transaction is processed (the number of datasegments that should be written to the journal is known based on a listof modified data segments). Then the data segments involved in thetransaction are written 553 from the cache to the journal, using I/Ooperations which are optimized for the storage device holding thejournal. This is followed by releasing 554 the exclusive permissions onthe data segments involved in the transaction. Finally, the procedurechecks 555 whether conditions that trigger a checkpoint are fulfilled.Examples of conditions for triggering a checkpoint are the relativeportion of the journal that is occupied by transactions; the number ofmodified data segments; and the relative portion of the cache containingmodified data segments. Checkpointing may be done in the background(a.k.a. asynchronous checkpoint), or in the foreground (a.k.a.synchronous checkpoint). Generally, when the conditions indicate thatresources for recording further transactions are low, a synchronouscheckpoint is executed; otherwise an asynchronous checkpoint is executed(if at all). If the said conditions are fulfilled then the appropriatecheckpoint procedure (specified next) is executed, and the commitprocedure terminates 556.

A procedure 570 for checkpointing (FIG. 22) writes data segments ofcommitted transactions from the cache to their final location in theshared storage. Synchronous checkpoints have an additionalresponsibility, which is to ensure that resources for recording furthertransactions are sufficient. Such resources are mainly the spaceavailable in the journal and in the cache. Since a synchronouscheckpoint is executed when these resources are low, such a checkpointis synchronous in the sense that further transactions on the relevantcomputer are blocked until completion of the checkpoint. Adversely,asynchronous checkpoints allow further transactions during operation.Note that checkpoints are performed concurrently from the computers inthe cluster, writing data segments to the shared storage. This ispossible since each computer writes different data segments within theconcurrent checkpoints to the shared storage (as elaborated later).

As illustrated in FIG. 22, the checkpoint procedure 570 marks 571 allmodified and committed data segments in the cache as being written totheir final location. Then write operations 572 are generated for eachof these data segments and sent to the I/O subsystem for backgroundexecution. Dedicated threads of the file system dispatch these writeoperations and monitor their completion. Upon completion, the said markon the associated cache data segments is cleared 573, and users that maybe blocked on accessing these data segments are awakened.

As illustrated in FIG. 22, a procedure 580 is provided for creating ashadow data segment in case other users request 581 access to a markeddata segments for modification. In such cases, upon identifying the markof data segment 582, a shadow data segment is created 583 in the cachefor each required data segment that was dispatched for checkpointing,and these shadow pages are provided to the user; otherwise the originalcache data segments are provided to the user 584. The contents of ashadow data segment is identical to that of the original data segment.Providing shadow data segments is done so that modification ofdispatched data segments will not interfere with writing their stablecontents. Upon completion of the checkpoint operation (see FIG. 22), theshadow data segments replace 574 in cache their corresponding originaldata segments which participated in the checkpoint. There may be alsocases where users require to ensure that a dispatched data segment iswritten to its final location (e.g. upon transfer of data segmentownership). In such cases, these users block upon identifying this mark,and are awakened upon completion of the data segment write operation.Before termination 576, the checkpoint procedure reclaims 575 theinterval in the journal that consists of the transactions whose datasegments were written to their final location. This is done by updatingthe journal's header data segment.

A procedure 590 for rolling-back an ongoing transaction (FIG. 24)restores the file system to its state before the beginning of theongoing transaction, thus canceling the transaction and its effects onthe file system. Stated generally, this procedure restores in the cachethe contents of the data segments that were modified within thecancelled transaction, to their latest contents that prevailed beforethat transaction began. This procedure scans 591 the list of datasegments modified within the ongoing transaction. Each data segment inthis list may be of one of two types. A data segment of the first typeis a data segment whose latest contents, before the beginning of theongoing transaction, is located in its final location in the sharedstorage. A data segment of the second type is a data segment whoselatest contents appears in the journal and not in its final location inthe shared storage. For each data segment in the said list, the type ofthe data segment is known upon insertion of the data segment to the listduring the transaction. If it is determined 592 that the data segment ismarked as modified in the cache (i.e. its latest contents does notappear in its final location in the shared storage) during insertioninto the list, then this data segment is of the second type; otherwisethe data segment is of the first type. The type of each data segment isrecorded in the list. All data segments in the list which are of thefirst type may be safely discarded 594 from the cache. For the datasegments in the list which are of the second type, their latest contentsis restored 593 from the journal into the cache and their modificationindication is set to true (so that these data segments can be written totheir final location in the shared storage). To identify the latestcontents of the data segments of the second type, the roll-backprocedure scans the journal (FIG. 20) from its ending to its beginning.Each data segment appearing in the journal, which also appears in thesaid list, is read from the journal and restored in cache, setting itsmodification indication to true, and its entry is removed from the list.Removal from the list is performed, since previous occurrences of thatdata segment in the journal are less recent, in terms of contents, thanthe last occurrence of that data segment in the journal, thus can beignored. When the list is empty, the roll-back procedure releases 595the exclusive permissions on all the data segments involved in thecancelled transaction, and terminates 596.

A procedure 600 for recovery (FIG. 25) restores the consistency of thefile system, after failure of one of more a computers in the cluster, toits most recent consistent state. In an on-line recovery procedure, aremaining operational computer in the cluster performs recovery duringconcurrent normal work in the cluster. In an off-line recoveryprocedure, an operational computer in the cluster performs recoverywithout concurrent normal work in the cluster. In essence, the committedtransactions in the journals of the failed computers, and more preciselythe latest contents of the unique data segments within the journals ofthe failed computers, are written to their final location in the sharedstorage. Recentness is compared and determined based on the transactionidentifier embedded within each data segment.

The recovery procedure scans 601 concurrently the transaction journalsof the failed computers, from their ending to their beginning A journalis defined to end at its latest complete transaction (namely, anincomplete transaction is ignored). The transactions within thesejournals are scanned according to their order of recentness, from themost recent to the oldest, using the global and unique ordering of thetransactions across the cluster. In this scan, only the most recentoccurrence of each data segment is considered, by maintaining a list ofdata segments that were already processed, and for each data segmentread from the journals, which is already in that list, the procedureignores that occurrence of the data segment. For each occurrence of anewly processed data segment, the procedure determines if it should becopied to its final location by validating 602 that ownership of thatdata segment is not associated with any of the remaining operationalfile system agents, via the DSM component, which manages permissions andownerships on all disk data segments. For this purpose the DSM agentbroadcasts a message querying on ownership of that data segment to alloperational agents, and determines whether ownership of that datasegment is associated with any of the remaining operational file systemagents or not according to their responses. Ownership of a data segmentsignifies possession of the latest contents of that data segment andresponsibility of the owning file system agent to checkpoint that datasegment, as specified later. If ownership is ensured to be associatedwith an operational file system agent, then it is guaranteed that thedata segment contents as last modified by the failed file system agentwas already written to its final location in the shared storage beforetransferring ownership. This last check enables to prevent overriding ofthe latest contents of a data segment already written to its finallocation by its operational owning file system agent, with obsoletecontents held by the agent performing recovery. Since however in theoff-line recovery scenario, there is no other operational agent beyondthe one performing recovery, this check is not performed in the off-linescenario. For each data segment whose ownership is not associated withany of the remaining operational file system agents, the recoveryprocedure sets 603 the local DSM agent to be the owner of that datasegment, and proceeds to check 604 if the corresponding data segment inits final location has a transaction identifier which is less recentthan the one of the data segment read 605 from the journal. Only in thiscase the data segment read from the journal is written to its finallocation; otherwise it is ignored. Each data segment that should bewritten to its final location is recorded in a list along with a pointerto the latest contents of that data segment in the appropriate journal.Upon completion of scanning of the journals, the list of data segmentsthat should be written to their final locations is complete. Then, thedata segments recorded in this list are written to their finallocations. Finally, the recovery procedure resets 606 the processedjournals and terminates 607. In the on-line recovery procedure, normalactivity of other users is blocked until scanning of all journals of thefailed file system agents is complete, and all data segments that arecandidates to be copied from the journals to their final locations havebeen identified, and their ownerships are reclaimed by the recoveringfile system agent. From that point in time, normal activity of otherusers is unblocked. Comparison of these candidate data segments withtheir associated data segments in their final location is done in thebackground, as well as copying the data segments in the final list totheir final location. Concurrent activities of other users that mayrequire access to these candidate data segments are blocked selectivelyuntil these data segments are either written to or identified in theirfinal location. Candidate data segments that are required for access byconcurrent activities of other users receive higher priority in therecovery process relative to other candidate data segments.

One challenge for the recovery procedures within the present transactionprocessing method, is determining the whereabouts of the latest contentsof a given data segment. Another challenge posed by the present methodis parallel (concurrent) checkpoints being performed from multiplecomputers in the cluster to shared storage, where it is crucial that nomore than one computer checkpoints the same data segment at any giventime (to avoid possible overriding of the latest contents of a datasegment). To facilitate both challenges efficiently, a particular logicis embedded within the DSM component in the present embodiment, asspecified herewith. The basic idea is that the responsibility tocheckpoint a data segment is always assigned to a single file systemagent in the cluster, which is the one whose associated DSM agent is theowner of that disk data segment. To enforce these requirements, whenevera DSM agent determines that it is required to transfer ownership of adisk data segment (see steps 561-563 of FIG. 26), it first ensures thatthe latest contents of that data segment is written 564 to its finallocation in the shared storage, also clearing 564 its modificationindication if it exists, and only then transfers ownership 565. Notethat before this operation the latest contents of the data segment maybe only in the cache and transaction journal of the owning file systemagent. Also, if the current owner of a data segment has to evacuate themodified data segment from its associated cache, it writes the datasegment to its final location in the shared storage.

This ensures two essential properties of the present method:

-   -   1. At concurrent checkpoints from multiple file system agents on        different computers, each file system agent checkpoints        different data segments (since there is a unique owner of each        data segment at any given time). Moreover, for each file system        agent the data segments that should be checkpointed by that file        system agent are always a subset of the data segments whose        latest contents are in its own transaction journal (rather than        a subset of all the data segments in all the transaction        journals).    -   2. During recovery, the data segments that should have been        written to their final location but were not written due to a        failure of a computer C are located only in the transaction        journal associated with C. Furthermore, the data segments in the        journal associated with computer C, that should indeed be        written to their final location in the shared storage during        recovery are those whose ownership may be associated with the        file system agent on computer C (i.e. their ownership is not        associated with any file system agent on any operational        computer in the cluster; in the complementary case it is        guaranteed that the data segment contents as last modified by        the file system agent on computer C was already written to its        final location in the shared storage before transferring        ownership).        C-4. Summary of Transactional Processing in CFS

There has been described an efficient method for transactionalprocessing, providing consistency and recovery, within clustered filesystems, where transaction boundaries are defined by users of the filesystem based on user application logic. Users are provided with aninterface for utilizing the transactional mechanism, namely services foropening, committing and rolling-back transactions. The operations joinedinto user defined transactions are on data segments within the filesystem. The proposed method for supporting transactional processing isintegrated with a distributed shared memory technology, whichfacilitates efficient and coherent cache management within a clusteredfile system, via algorithms in both components, to enable efficientclustered processing.

C-5. System, Method and Computer Program Product

As will be appreciated by one skilled in the art, the present inventionmay be embodied as a system, method or computer program product.Accordingly, unless specified to the contrary, the present invention maytake the form of an entirely hardware embodiment, an entirely softwareembodiment (including firmware, resident software, micro-code, etc.) oran embodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, the present invention may take the form of a computerprogram product embodied in any tangible medium of expression havingcomputer-usable program code embodied in the medium.

Any combination of one or more computer-usable or computer-readablemedium(s) may be utilized, unless specified to the contrary herein. Thecomputer-usable or computer-readable medium may be, for example but notlimited to, electronic, magnetic, optical, electromagnetic, infrared, orsemiconductor. More specific examples (a non-exhaustive list) include: aportable computer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), an optical fiber, a portable compact disc read-onlymemory (CDROM), an optical storage device.

Computer program code for carrying out operations of the presentinvention may be written in any combination of one or more programminglanguages, including an object oriented programming language such asJava, Smalltalk, C++ or the like and conventional procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The program code may execute entirely on a user's computer,partly on the user's computer, as a stand-alone software package, partlyon a user's computer and partly on a remote computer or entirely on theremote computer or server. In the latter scenario, the remote computermay be connected to the user's computer through any type of network,including a local area network (LAN) or a wide area network (WAN), orthe connection may be made to an external computer (for example, throughthe Internet using an Internet Service Provider).

The present invention is described above with reference to flowchartillustrations and/or block diagrams of methods, apparatus (systems) andcomputer program products according to embodiments of the invention. Itwill be understood that each block of the flowchart illustrations and/orblock diagrams, and combinations of blocks in the flowchartillustrations and/or block diagrams, can be implemented by computerprogram instructions. These computer program instructions may beprovided to a processor of a general purpose computer, special purposecomputer, or other programmable data processing apparatus to produce amachine, such that the instructions, which execute via the processor ofthe computer or other programmable data processing apparatus, createmeans for implementing the functions/acts specified in the flowchartand/or block diagram block or blocks.

These computer program instructions may also be stored in acomputer-readable medium that can direct a computer or otherprogrammable data processing apparatus to function in a particularmanner, such that the instructions stored in the computer-readablemedium produce an article of manufacture including instruction meanswhich implement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams illustrate the architecture,functionality, and operation of possible implementations of systems,methods and computer program products according to various embodimentsof the present invention. In this regard, each block in the flowchart orblock diagrams may represent a module, segment, or portion of code,which comprises one or more executable instructions for implementing thespecified logical function(s). It should also be noted that, in somealternative implementations, the functions noted in the block may occurout of the order noted in the figures. For example, two blocks shown insuccession may, in fact, be executed substantially concurrently, or theblocks may sometimes be executed in the reverse order, depending uponthe functionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts, or combinations of special purpose hardware andcomputer instructions.

By way of example only, the described embodiments of the DSM may beimplemented on any cluster of x86_(—)64 processor based servers, eachhaving its own RAM and the servers connected via a Gbit Ethernet networkusing two Gbit Ethernet switches such that each server is connected toeach of the switches. By way of example only, the described embodimentsof the CFS with transactional processing may be implemented on anycluster of x86_(—)64 processor based servers, each having its own cache(RAM) and sharing an external storage device. The ratio of cache sizeversus disk size may be tuned in order to achieve a desired level ofperformance, such that increasing the cache size relative to the disksize enables to increase cache hits and thus increase performance. Anexample of hardware configuration, enabling implementation of anenterprise class solution providing sustained high performance, utilizesx86_(—)64 processor based servers with 32 GB RAM each, and a standardexternal disk array, e.g. IBM DS8000, of 1PB.

Modifications can be made to the previously described embodiments of thepresent invention and without departing from the scope of the invention,the embodiments being illustrative and not restrictive.

What is claimed is:
 1. A method for implementing transactionalmechanisms by a plurality of procedures on data segments by usingdistributed shared memory (DSM) agents in a clustered file system (CFS)using a processor device, the method comprising: allocating a new datasegment and adding an associated cache data segment and metadata datasegments, which are allocated for the new data segment and loaded into acache and modified during the allocating of the new data segment, to alist of data segments modified within an associated transaction, whereinthe DSM agents assigns an exclusive permission on the new data segment;and retrieving a disk data segment for usage by examining the cache forthe presence of a cache data segment associated with the disk datasegment; wherein if the disk data segment is not associated with thecache data segment: associating the cache data segment with the diskdata segment, wherein if the cache data segment is associated with thedisk data segment: creating a shadow data segment in the cache for anode if the cache data segment is currently being written to a finalstorage location with an asynchronous checkpoint operation and the noderequires exclusive permission on the disk data segment, and uponcompletion of the asynchronous checkpoint operation: disassociating thecache data segment from the disk data segment, wherein the shadow datasegment is a sole representation of the disk data segment within thecache, and acquiring permission on the disk data segment via one of theDSM agents according to a request by the node for one of exclusive andshared permission.
 2. The method of claim 1, further includingde-allocating an allocated data segment by removing the de-allocateddata segment from the list of data segments modified within theassociated transaction and inserting into a list of metadata datasegments that were modified in the process of de-allocating theallocated data segment.
 3. The method of claim 2, further includingensuring that an active exclusive permission is on a de-allocated diskdata segment and releasing the active exclusive permission by thede-allocated disk data segment if the de-allocated disk data segmentacquires the active exclusive permission before completion of thede-allocating.
 4. The method of claim 1, further including, uponacquiring the permission on the disk data segment, performing one of:providing an instruction for obtaining the most recent contents on thedisk data segment by the one of the DSM agents, and reading the diskdata segment from the final storage location if the one of the DSMagents instructs the most recent contents of the disk data segment to beread and the one of the DSM agents instructs that contents in the cacheare the most recent contents but new cache data is associated with thedisk data segment.
 5. The method of claim 1, further including releasingthe disk data segment via the one of the DSM agents for releasing ausage of a retrieved data segment.
 6. The method of claim 1, furtherincluding marking a retrieved data segment as modified and inserting theretrieved data segment into the list of data segments modified in theassociated transaction and accompanying the retrieved data segment withan indication of whether the retrieved data segment was marked asmodified prior to the marking.
 7. A system implementing transactionalmechanisms by a plurality of procedures on data segments by usingdistributed shared memory (DSM) agents in a clustered file system (CFS),the system comprising: a cluster of nodes, the CFS including the clusterof nodes forming a computer cluster, distributed shared memory (DSM)agents within each of a node of the cluster of nodes, a cache associatedwith the node, a plurality of lists of data segments associated with theCFS, a plurality of storage devices in communication with the CFS,wherein the plurality of storage devices include a final storagelocation, and a processor device having a memory coupled to theprocessor device for controlling the CFS, wherein the node is assignedthe processor device and the node is in communication with the pluralityof storage devices, wherein the processor device: allocates a new datasegment and adding an associated cache data segment and metadata datasegments, which are allocated for the new data segment and loaded into acache and modified during the allocating of the new data segment, to alist of data segments modified within an associated transaction, whereinthe DSM agents assigns an exclusive permission on the new data segment;and retrieves a disk data segment for usage by examining the cache forthe presence of a cache data segment associated with the disk datasegment; wherein if the disk data segment is not associated with thecache data segment: the cache data segment is associated with the diskdata segment, wherein if the cache data segment is associated with thedisk data segment: a shadow data segment is created in the cache for anode if the cache data segment is currently being written to a finalstorage location with an asynchronous checkpoint operation and the noderequires exclusive permission on the disk data segment, and uponcompletion of the asynchronous checkpoint operation:  the cache datasegment is disassociated from the disk data segment, wherein the shadowdata segment is a sole representation of the disk data segment withinthe cache, and  permission is acquired on the disk data segment via oneof the DSM agents according to a request by the node for one ofexclusive and shared permission.
 8. The system of claim 7, wherein theprocessor device de-allocates an allocated data segment by removing thede-allocated data segment from the list of data segments modified withinthe associated transaction and inserting into a list of metadata datasegments that were modified in the process of de-allocating theallocated data segment.
 9. The system of claim 8, wherein the processordevice ensures that an active exclusive permission is on a de-allocateddisk data segment and releasing the active exclusive permission by thede-allocated disk data segment if the de-allocated disk data segmentacquires the active exclusive permission before completion of thede-allocating.
 10. The system of claim 7, wherein the processor device,upon acquiring the permission on the disk data segment, performs one of:providing an instruction for obtaining the most recent contents of bythe one of the one of the DSM agents on the disk data segment, andreading the disk data segment from the final storage location if the oneof the DSM agents instructs the most recent contents of the disk datasegment to be read and the one of the DSM agents instructs that contentsin the cache are the most recent contents but new cache data isassociated with the disk data segment.
 11. The system of claim 7,wherein the processor device releases the disk data segment via the oneof the DSM agents for releasing a usage of a retrieved data segment. 12.The system of claim 7, wherein the processor device marks a retrieveddata segment as modified and inserting the retrieved data segment intothe list of data segments modified in the associated transaction andaccompanying the retrieved data segment with an indication of whetherthe retrieved data segment was marked as modified prior to the marking.13. A computer program product implementing transactional mechanisms bya plurality of procedures on data segments by using distributed sharedmemory (DSM) agents in a clustered file system (CFS) using a processordevice, the computer program product comprising a non-transitorycomputer-readable storage medium having computer- readable program codeportions stored therein, the computer-readable program code portionscomprising: a first executable portion that allocates a new data segmentand adding an associated cache data segment and metadata data segments,which are allocated for the new data segment and loaded into a cache andmodified during the allocating of the new data segment, to a list ofdata segments modified within an associated transaction, wherein the DSMagents assigns an exclusive permission on the new data segment; and asecond executable portion that retrieves a disk data segment for usageby examining the cache for the presence of a cache data segmentassociated with the disk data segment; wherein if the disk data segmentis not associated with the cache data segment: the cache data segment isassociated with the disk data segment, wherein if the cache data segmentis associated with the disk data segment: a shadow data segment iscreated in the cache for a node if the cache data segment is currentlybeing written to a final storage location with an asynchronouscheckpoint operation and the node requires exclusive permission on thedisk data segment, and upon completion of the asynchronous checkpointoperation: the cache data segment is disassociated from the disk datasegment, wherein the shadow data segment is a sole representation of thedisk data segment within the cache, and permission is acquired on thedisk data segment via one of the DSM agents according to a request bythe node for one of exclusive and shared permission.
 14. The computerprogram product of claim 13, further including a second executableportion that de-allocates an allocated data segment by removing thede-allocated data segment from the list of data segments modified withinthe associated transaction and inserting into a list of metadata datasegments that were modified in the process of de-allocating theallocated data segment.
 15. The computer program product of claim 14,further including a third executable portion that ensures that an activeexclusive permission is on a de-allocated disk data segment andreleasing the active exclusive permission by the de-allocated disk datasegment if the de-allocated disk data segment acquires the activeexclusive permission before completion of the de-allocating.
 16. Thecomputer program product of claim 13, further including a thirdexecutable portion that, upon acquiring the permission on the disk datasegment, performs one of: providing an instruction for obtaining themost recent contents of by the one of the DSM agents on the disk datasegment, and reading the disk data segment from the final storagelocation if the one of the DSM agents instructs the most recent contentsof the disk data segment to be read and the one of the DSM agentsinstructs that contents in the cache are the most recent contents butnew cache data is associated with the disk data segment.
 17. Thecomputer program product of claim 13, further including a thirdexecutable portion that releases the disk data segment via the one ofthe DSM agents for releasing a usage of a retrieved data segment. 18.The computer program product of claim 13, further including a secondexecutable portion that marks a retrieved data segment as modified andinserting the retrieved data segment into the list of data segmentsmodified in the associated transaction and accompanying the retrieveddata segment with an indication of whether the retrieved data segmentwas marked as modified prior to the marking.